import axiosServer from '../utils/request'


/**
 * 商品列表
 * @returns 
 */

export const RequestProductList = (pageNo = 1, pageSize = 10) => {
    return axiosServer({
        method: 'get',
        url: '/api/shop',
        params: {
            pageNo, pageSize
        }
    })
}


/**
 * 商品分类列表
 * @returns 
 */

 export const RequestCategoryList = () => {
    return axiosServer({
        method: 'get',
        url: '/api/shop/category/list',
        
    })
}

/**
 * 添加商品
 * @returns 
 */

 export const RequestAddProduct = (product) => {
    return axiosServer({
        method: 'post',
        url: '/api/shop/add',
        data:{
            categoryId:product.categoryId,
            product:product.productname,
            picture:product.picture,
            shop:product.shop,
            price:product.price,
            oldPrice:product.oldPrice,
            putaway:product.putaway

        }
        
    })
}

/**
 * 删除商品
 * @returns 
 */

export const RequestDeleteProduct = (id:number)=>{
    return axiosServer({
        method:'get',
        url:'/api/shop/delete',
        params:{
           id
        }
    })
}
